package com.tencent.cloud.uikit.widget.edittext;

import android.content.Context;
import android.text.InputFilter;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;

import com.tencent.cloud.iov.util.PatternMatchingUtils;
import com.tencent.cloud.iov.util.ResourcesUtils;
import com.tencent.cloud.uikit.R;

/**
 * @author vinsonhuang
 * @date 2018/8/20
 */
public class PasswordEditText extends LineEditText {

    public static final int MIN_LENGTH = 6;

    public static final int MAX_LENGTH = 12;

    /**
     * @param context
     * @param attrs
     */
    public PasswordEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        setTransformationMethod(PasswordTransformationMethod.getInstance());
        setTextColor(ResourcesUtils.getColor(R.color.text_color_primary));
        setTextFormat(PatternMatchingUtils.PASSWORD_FORMAT);
        setFilters(new InputFilter[]{new InputFilter.LengthFilter(MAX_LENGTH)});
    }
}
